import { app, BrowserWindow } from "electron";
import path from "path";

const createWindow = () => {
  const mainWindow = new BrowserWindow({
    width: 1000,
    height: 800,
    webPreferences: {
      nodeIntegration: true, //集成node
      //预加载
      preload: path.resolve(__dirname, "./preload"), //必须是绝对路径，不能是相对路径
    },
  });

  mainWindow.loadURL("http://localhost:5173/");

  //打开开发者工具
  mainWindow.webContents.openDevTools();
};

app.whenReady().then(() => {
  createWindow();
});
